<script>
	export default {
		onLaunch: function() {
			console.log('App Launch')
		},
		onShow: function(e) {
			console.log('App Show', e)

			const href = window.location.href
			const regex = /hwLogin/;
			const regex2 = /qdsm/;
			const regex3 = /userInfo/;
			const token = uni.getStorageSync('token')
			if (regex.test(href) || regex2.test(href) || regex3.test(href)) {
				if (token) {
					uni.navigateTo({
						url: `/pages/qdsm/qdsm?type=${e.query.type || 1}&meetType=${e.query.meetType || 1}`,
					})
				} else {
					uni.navigateTo({
						url: `/pages/hwLogin/index?type=${e.query.type || 1}&meetType=${e.query.meetType || 1}`,
					})
				}
			} else {
				if (token) {
					uni.navigateTo({
						url: '/pages/home/index'
					})
				} else {
					if (e.query && e.query.isAdmin) {
						uni.navigateTo({
							url: `/pages/index/index?isAdmin=${e.query.isAdmin}`
						})
					} else {
						uni.navigateTo({
							url: '/pages/index/index'
						})
					}

				}
			}

		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style>
	/*每个页面公共css */
	* {
		padding: 0;
		margin: 0;
		box-sizing: border-box;
	}

	uni-page-body,
	uni-page-refresh {
		width: 100%;
		height: 100%;
	}
</style>